<template>
  <div class="xui-fc spec-display">
    <ul class="class-menu">
      <li v-for="(item,index) in types" :key="index">
        <router-link :to="{name:'specExhibition-exhibit-list',params:{typeId: item.id}}">
          <span v-if="isCN">{{item.typeName}}</span>
          <span v-else>{{item.typeNameEn}}</span>
        </router-link>
      </li>
    </ul>
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import { getClass } from "@/api/specExhib";
import { getLang } from "@/utils/lang";
export default {
  data() {
    return {
      types: []
    };
  },
  computed: {
    isCN() {
      return getLang() !== "en";
    }
  },
  mounted() {
    this.$nextTick(() => {
      let id = this.$route.params.id;
      getClass(id).then(res => {
        this.types = res.data.recordsList;
        console.log(this.$route.name == "specExhibition-exhibit");
        if (
          res.data.recordsList &&
          this.$route.name == "specExhibition-exhibit"
        ) {
          this.$router.replace({
            name: "specExhibition-exhibit-list",
            params: { typeId: res.data.recordsList[0].id }
          });
        }
      });
    });
  }
};
</script>

